<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    //      function add(){
    //      let xhr = new XMLHttpRequest()
    //     xhr.open("post", "http://localhost:4300/login")
    //     xhr.setRequestHeader("Content-Type","application/json")
    //     let obj={
    //         username:"admin",
    //         password:"123456",
    //     }
    //     xhr.send(JSON.stringify(obj))
    //     xhr.onreadystatechange = function(){
    //         if(xhr.readyState == 4){
    //         let res = JSON.parse(xhr.responseText)
    //         console.log(res);
    //     }
    // }
    // }
    // add()

    // 新增
    function user(){
         let xhr = new XMLHttpRequest()
        xhr.open("post", "http://localhost:4300/add")
        xhr.setRequestHeader("Content-Type","application/json")
        let obj={
            username:"adminsdsd",
            password:"123456789",
        }
        xhr.send(JSON.stringify(obj))
        xhr.onreadystatechange = function(){
            if(xhr.readyState == 4){
            let res = JSON.parse(xhr.responseText)
            console.log(res);
        }
    }
    }
    user()
    </script>
</body>
</html>